<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <img src="./R-C.jpg"  style="width: 700px; height:500px">
    <script>
        var img = document.getElementsByTagName('img')[0];
        const imgArr = ['R-C.jpg', 'OIP-C.jpg', 'OIP-C(1).jpg'];
        var count = 0;

        function fn() {
            if(count<3){
                count++;
            }else{
                count = 0;
            }
            
            img.src = './img/' + imgArr[count];
            return setTimeout(fn, 300);
        }
        setTimeout(fn, 300);
    </script>
</body>
</html>